home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / Direct3D / DXTex / ChildFrm.cpp next >
C/C++ Source or Header  |  2001-10-08  |  3KB  |  113 lines

  1. // ChildFrm.cpp : implementation of the CChildFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "dxtex.h"
  6. #include "dxtexdoc.h"
  7. #include "dxtexview.h"
  8.  
  9. #include "ChildFrm.h"
  10.  
  11. #ifndef WM_IDLEUPDATECMDUI
  12.     #define WM_IDLEUPDATECMDUI  0x0363  // wParam == bDisableIfNoHandler
  13. #endif
  14.  
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20.  
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CChildFrame
  23.  
  24. IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
  25.  
  26. BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
  27.     //{{AFX_MSG_MAP(CChildFrame)
  28.     ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)
  29.     //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CChildFrame construction/destruction
  34.  
  35. CChildFrame::CChildFrame()
  36. {
  37. }
  38.  
  39. CChildFrame::~CChildFrame()
  40. {
  41. }
  42.  
  43. BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
  44. {
  45.     if( !CMDIChildWnd::PreCreateWindow(cs) )
  46.         return FALSE;
  47.  
  48.     return TRUE;
  49. }
  50.  
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CChildFrame diagnostics
  54.  
  55. #ifdef _DEBUG
  56. void CChildFrame::AssertValid() const
  57. {
  58.     CMDIChildWnd::AssertValid();
  59. }
  60.  
  61. void CChildFrame::Dump(CDumpContext& dc) const
  62. {
  63.     CMDIChildWnd::Dump(dc);
  64. }
  65.  
  66. #endif //_DEBUG
  67.  
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CChildFrame message handlers
  70.  
  71. BOOL CChildFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CMDIFrameWnd* pParentWnd, CCreateContext* pContext) 
  72. {
  73.     if (!CMDIChildWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, pContext))
  74.         return FALSE;
  75.  
  76.     return TRUE;
  77. }
  78.  
  79.  
  80.  
  81. // Handle WM_IDLEUPDATECMDUI to update modified indicator if necessary.
  82. LRESULT CChildFrame::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM)
  83. {
  84.     // Only update the title if the doc or view state has changed.
  85.     // Otherwise, the title bar will flicker.
  86.     CDxtexDoc* pDoc = (CDxtexDoc*)GetActiveDocument();
  87.     CDxtexView* pView = (CDxtexView*)GetActiveView();
  88.     if (pView->TitleModsChanged() || pDoc->TitleModsChanged())
  89.     {
  90.         // This will force MFC to call CChildFrame::OnUpdateTitleFrame:
  91.         m_nIdleFlags |= idleTitle;
  92.         pView->ClearTitleModsChanged();
  93.         pDoc->ClearTitleModsChanged();
  94.     }
  95.  
  96.     // Do the default thing
  97.     CMDIChildWnd::OnIdleUpdateCmdUI();
  98.     return 0L;
  99.  
  100.  
  101. void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
  102. {
  103.     CMDIChildWnd::OnUpdateFrameTitle(bAddToTitle);
  104.     CDxtexView* pView = (CDxtexView*)GetActiveView();
  105.     {
  106.         CString title;
  107.         GetWindowText(title);
  108.         title += " " + pView->GetStrTitleMods();
  109.         SetWindowText(title);
  110.     }
  111. }
  112.